package com.nexgo.payment.trans.version;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.nexgo.payment.BuildConfig;
import com.nexgo.payment.R;
import com.nexgo.payment.ui.BaseActivity;
import com.nexgo.payment.util.UIUtils;
import com.nexgo.payment.widget.TitleBuilder;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 应用版本信息
 *
 * @author 谭忠扬-YuriTam
 * @time 2017年8月11日
 */
public class VersionActivity extends BaseActivity {
    private static final String TAG = VersionActivity.class.getSimpleName();

    @BindView(R.id.tv_version)
    TextView tvVersion;
    @BindView(R.id.tv_cert_no)
    TextView tvCertNo;

    private Context mContext;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_version);
        ButterKnife.bind(this);

        mContext = this;

        initTitle();
        initData();
    }

    //初始标题栏
    private void initTitle() {
        new TitleBuilder(this)
                .setExternalTitleBgRes(R.drawable.bg_blue_icon)
                .setLeftImage(R.drawable.arrow_icon)
                .setTitleText(getString(R.string.version_info))
                .build();
    }

    //初始化数据
    private void initData(){
        tvVersion.setText(BuildConfig.APP_INNER_VERSION);
        tvCertNo.setText("0000");
    }

    @OnClick({R.id.title_iv_left, R.id.btn_confirm})
    public void onClicked(View view) {
        if (UIUtils.isDoubleClick()) return;
        switch (view.getId()) {
            case R.id.title_iv_left:
            case R.id.btn_confirm:
                finish();
                break;
        }
    }
}
